﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using OfficialWeb.Application;

using OOS.Application.User.Services.Interfaces;
using OOS.Core.User;

namespace OOS.Application.User
{
    /// <summary>
    /// 用户个人信息管理
    /// </summary>
    [Route("[Controller]")]
    public class UserInfoAppService:IDynamicApiController
    {
        private readonly IUserInfoService _userInfoService;

        public UserInfoAppService(IUserInfoService userInfoService)
        {
            _userInfoService = userInfoService;
        }

        /// <summary>
        /// 根据用户id获取用户个人信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public UserInfo GetUserInfo()
        {
            return _userInfoService.SelectUserInfoByUserId();
        }
        /// <summary>
        /// 根据id修改用户个人信息
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        [HttpPut]
        public Boolean UpdateUserInfo(UserInfo userInfo)
        {
            return _userInfoService.UpdateUserInfoById(userInfo);
        }
    }
}
